import axios from "axios";

const API_URL='/api'

//获取会议室列表
const rooms = async(data)=>{
    const response = await axios.get(API_URL+'/room/list',{
        params:data,
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}

//添加会议室
const addroom = async(data)=>{
    const response = await axios.post(API_URL+'/room/add',data,{
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}

//修改会议室
const updateroom = async(data)=>{
    const response = await axios.post(API_URL+'/room/update',data,{
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}
//删除会议室
const delroom = async(data)=>{
    const response = await axios.delete(API_URL+'/room/delete/'+data,{
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}

const delmore=async(data)=>{
    const response = await axios.delete(API_URL+'/room/delete',JSON.stringify(data),{
        headers:{
            'Authorization':"Bearer "+localStorage.getItem('token')
        }
    })
    return response.data
}

export default{
    rooms,
    addroom,
    updateroom,
    delroom,
    delmore
}